<!doctype html>
<html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
%>
<head>
    <meta charset="UTF-8">
    <title>后台管理</title>
    <link rel="stylesheet" type="text/css" href="css/common.css"/>
    <link rel="stylesheet" type="text/css" href="css/main.css"/>
    <script type="text/javascript" src="js/libs/modernizr.min.js"></script>
    <jsp:include page="/manage/inc/header"></jsp:include>
</head>
<body>

<!--/sidebar-->
<div class="main-wrap">

    <div class="result-content" id="show">

    </div>
    </form>
</div>
</div>
<!--/main-->
</div>
</body>
<jsp:include page="/manage/inc/footer"></jsp:include>
<script>
    $(function () {
    initData(1)
    })
    function initData(pageNum) {
        var action = "<%=path%>/manage/news/ajaxJsp/newsShow";
        $.post(action, {pageNum: pageNum}, function (mes) {
            $("#show").html(mes)
        })
    }
    //分页
    $(function () {
        $("#show").on("click",".list",function () {
            var pageNum = $(this).data("id");
            initData(pageNum);
        })
    })
    //删除
    $(function () {
        $("#show").on("click",".link-del",function () {
            var id = $(this).data("id");
            layer.confirm("确定要删除吗",function () {
                var url = "<%=path%>/manage/news/delete"
                $.post(url,{id:id},function (mes) {
                    $("tr[id=tr"+id+"]").remove();
                    layer.msg("已经删除")
                })
            })
        })
    })
$(function () {
    $("#show").on("click",".new",function () {
        var id = $(this).data("id");
        //此处用于演示
        layer.open({
            type: 2,
            title: '文章信息',
            shadeClose: true,
            shade: false,
            maxmin: true, //开启最大化最小化按钮
            area: ['893px', '600px'],
            content: '<%=path%>/manage/news/selectById?id='+id
        });
    })
})
</script>
</html>
